package com.smart.builder.xml;

import com.smart.hotelsmart.SummaryHotelType;
import com.smart.persistence.entity.Destination;
import com.smart.persistence.entity.Hotel;
import com.smart.service.util.Logging;
import com.smart.service.util.UtilLink;

public class BuilderSummaryHotelType {
	
	private static final Logging LOGGER = Logging
	.getLogger(BuilderSummaryHotelType.class.getName());
	
	private SummaryHotelType summary = null;
	
	public BuilderSummaryHotelType(){
		summary = new SummaryHotelType();	
	}
	
	
	/*
	 * private SummaryHotelType createSummaryHotelTypeFromMap(Map<String,
	 * String> map){ LOGGER.debug("createSummaryHotelTypeFromMap");
	 * SummaryHotelType summary = new SummaryHotelType(); String codeHotel =
	 * map.get(SearchHotelService._codeHotel); assert codeHotel.matches("\\d+");
	 * int codeH = new Integer(codeHotel).intValue(); String codeDest =
	 * map.get(SearchHotelService._destinationId); assert
	 * codeDest.matches("\\d+"); int codeD = new Integer(codeDest).intValue();
	 * summary.setCodeHotel(codeH); summary.setDestinationId(codeD);
	 * summary.setNameHotel(map.get(SearchHotelService._name));
	 * summary.setLinkImage(map.get(SearchHotelService._linkImage));
	 * summary.setQuality(map.get(SearchHotelService._quality));
	 * summary.setLinkSelection(map.get(SearchHotelService._linkSelection));
	 * return summary; }
	 */

	public BuilderSummaryHotelType setHotel(Hotel hotel) {
		LOGGER.debug("setHotel");
		assert hotel != null;
		summary.setCodeHotel(hotel.getCodHotel());
		summary.setNameHotel(hotel.getName());
		summary.setLinkImage(UtilLink.getLinkImage(hotel.getLinkImage()));
		summary.setQuality(hotel.getQuality());
		summary.setLinkSelection(hotel.getLinkSelection());
		return this;

	}
	
	public BuilderSummaryHotelType setDestination(Destination destination) {
		LOGGER.debug("setDestination");
		assert destination != null;
		assert destination.getCodDestination() != 0;
		summary.setDestinationId(destination.getCodDestination());
		return this;

	}


	public SummaryHotelType getSummaryHotelType() {
		return summary;
	}
	
	

}
